package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.inspect.BPInspectItemType;
import com.joysuch.wwyt.bp.entity.inspect.BPInspectPointType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface BPInspectPointTypeRepository extends JpaRepository<BPInspectPointType, Long> {

    @Query(value = "update WWYT_BP_INSPECT_POINT_TYPE set type_count = type_count + :varCount    where id=:id  ", nativeQuery = true)
    @Modifying
    void updateInspectTypeCount(@Param("id") Long id, @Param("varCount")  int varCount);

    List<BPInspectPointType> findByTypeName(String typeName);

    List<BPInspectPointType> findByTypeNameAndIdIsNot(String typeName, Long id);


}
